import Vue from "vue";
import Vuex from "./kvuex";

Vue.use(Vuex);
// console.log(Vue)
export default new Vuex.Store({
    state: {
        count: 1
    },
    getters: {
        getCount(state) {
            return state.count * 100
        }
    },
    mutations: {
        add({state}, payload) {
            // console.log('add_mutations',state.count, payload)
            state.count+=payload
            // console.log(state.count)
        }
    },
    actions: {
        // 此处ctx 从何而来
        add({ commit },payload) {
            console.log('add_actions', payload)
            commit('add', payload)
        }
    },
    modules: {},
});
